<?php
/**
 * Created by .
 * User: luogan
 * Date: 2022/1/13
 */

namespace app\exception;

use think\Exception;
use app\constant\CodeConst;
class BaseException extends Exception
{
    //浏览器返回状态
    public $code = CodeConst::INVALID_PARAMETERS_ERROR;
    //返回错误信息
    public $msg = CodeConst::INVALID_PARAMETERS_ERROR_MSG;
    //api返回错误code状态
    public $errorCode = 400;

    //public $shouldToClient = true;

    /**
     * 异常基类构造函数
     * @param string $msg
     * @param int $errorCod
     * @param int $code
     */
    public function __construct($msg='',$errorCod=400,$code=400)
    {
        if($msg != ''){
            $this->msg = $msg;
        }
        if($errorCod != 400){
            $this->errorCod = $errorCod;
        }
        if($code != 400){
            $this->code = $code;
        }
    }
}